package com.me.template4j.util.encrypt;

import com.me.template4j.util.CommonUtil;

/**
 * base64的方式加密
 * @Authhor: qiu
 * @Date: 2022/12/12 1:48 下午
 */

public class Base64Encrypt implements Encrypt{

    @Override
    public String encoded(String str) {

        String base64Str = new CommonUtil().encodedStrToBase64(str);

        return base64Str;
    }

    @Override
    public String decoded(String str) {

        String originStr = new CommonUtil().decodedBase64ToStr(str);

        return originStr;
    }

    @Override
    public boolean compare(String psw1, String psw2) {

        String decoded1 = this.decoded(psw1);
        String decoded2 = psw2;

        return decoded1.equals(decoded2);
    }
}
